package com.baizhi.app;

import com.baizhi.common.R;
import com.baizhi.entity.CmfzBanner;
import com.baizhi.service.CmfzBannerService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

@RestController
@RequestMapping("/banner")
public class AppBannerController {

    @Autowired
    private CmfzBannerService cmfzBannerService;

    @GetMapping("/selectBanner/{id}")
    public R selectBanner(@PathVariable("id") Integer id){
        HashMap<Object, Object> map = new HashMap<>();

        QueryWrapper<CmfzBanner> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("banner_id",id);
        CmfzBanner banner = cmfzBannerService.getOne(queryWrapper);

        return R.ok().put("data",banner);
    }
}
